<!DOCTYPE html>
<html lang="en">
<head>
    <include file="Public:header" />
    <title></title>
</head>
<body>
	<header class="header">
		<h1>忘记密码</h1>
		<a href="#"><img src="__LHGImages__/iconfont-zuojiantou.png"></a>
	</header>
    <div class="mb50 mt50">
    	<p class="forgot"><span>账&nbsp;&nbsp;&nbsp;户：</span><input id="tel" type="text" placeholder="手机号"></p>
    	<p class="forgot"><span>验证码：</span><input type="number" placeholder="验证码"><a onClick="send_code()" href="javascript:;">获取验证码</a></p>
    	<h2 class="forgot1">请设定新密码</h2>
    	<p class="forgot"><span>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</span><input id="password1" type="password" placeholder="请输入新密码"></p>
    	<p class="forgot"><span>重复密码</span><input type="password" id="password2" placeholder="请重复输入新密码"></p>
        <input type="submit" onClick="reg()" value="提交" class="lhg-logo2" />
    </div>
	<script type="text/javascript">
	function send_code(){
	  var tel=$("#tel").val();
	  var reg = /^0?1[3|4|5|8][0-9]\d{8}$/;  
	  if(reg.test(tel)){
	   dialog("手号不正确");
	   return false;
	  }
	  $.post("Index/send_code",{tel:tel},function(data){
	    if(data.error>1){
		   dialog(data.msg);
		}else{
		  dialog("你的验证码是：".data.msg);
		}
	  })
	}
	/******注册*/
	function reg(){
	var password1= $("#password1").val();
	var password2= $("#password2").val();
	var tel= $("#tel").val();
	var code= $("#code").val();
	$.post("Index/register",{tel:tel,code:code,password2:password2,password1:password1},function(data){
	    if(data.error>1){
		   dialog(data.msg);
		}else{
		   window.location.href="Index/forgetpwdsuc";
		}
	  })
	}
	</script>
</body>
</html>